//
//  AppDelegate.m
//  07- UITablebareController
//
//  Created by GivenBmli on 16/7/22.
//  Copyright © 2016年 GivenBmli. All rights reserved.
//

#import "AppDelegate.h"
#import "ViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    _window.backgroundColor= [UIColor whiteColor];
    [_window makeKeyAndVisible];
        _window.rootViewController = [[UINavigationController alloc]initWithRootViewController:[[ViewController alloc]init]];
    
    
// UItabBarController 标签视图控制器
//    主要管理没层级的视图控制器
//    ViewControllers 所有被管理的视图控制器,都在这个数组中可以通过setter方法的形式,去赋值
//    也可以通过下述方法去赋值
//    2.setControllers:animated
//    3 通过一个数组创建完成后,如果数组中的控制器没有设置tabBarItem,会显示一个空的tableBarItem
//    4tableBarItem 根据自己的需求去创建对应的tableBarItem
//    UIViewController 的属性(Category)
//    因为:每个视图的控制器的tableBarItem都不一样因此不能设为TableBarControllerdde 的属性
//        badgeValue角标
//    5.创建:
//      initWithTabBarSystemItem: tag: 根据系统样式创建
//      initWithTitle:image:tag: 自定义文字图片创建
//      initWithTitle: image: selectedImage:根据自定义创建图片文字
//      如果数组个数过多(多于5个时),系统会把多余的内容,统一使用一种形式去管理 建议:不要超过5个
//    6.tableBar 高度49
//    1>barTintColor 背景颜色
//    2>tintColor 选中元素颜色
//    3>translucent
//    7.UIAppearance 全局设置
    [[UITabBar appearance] setTintColor:[UIColor yellowColor]];
    [[UITabBar appearance]setBarTintColor:[UIColor lightGrayColor]];
//    [[UINavigationBar appearance]setTintColor:<#(UIColor * _Nullable)#> ]
    [[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];
//    修改系统标题颜色
    [[UINavigationBar appearance]setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
//    vc 中self.title 与 self.namvigationItem,titlr 有区别
//    1.self.title 会修该两个内容 nagationItem.title 和 tableBarItem.title
//    2.self.navgationItem.title只修改navgationBar上的标题
    
   //    vc1.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemDownloads tag:0];
    
    
//
//    tabbar.tabBar .barTintColor = [UIColor yellowColor];
//    tabbar.tabBar.tintColor = [UIColor blackColor];
    
    UITabBarController *tabbar = [[UITabBarController alloc]init];
    ViewController *vc = [[ViewController alloc]init];
    UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:vc];
//    设置tabBarItem时, 给你要放进数组中的控制器去设置
    nav1.tabBarItem =[[UITabBarItem alloc]initWithTitle:@"新闻" image:nil tag:0];
//    设置标题.
    vc.navigationItem.title = @"新闻";
    
   
    
    [tabbar setViewControllers:@[nav1]];
    _window.rootViewController = tabbar;

    
    
    
    
    
    
    
    
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
